import type { UserApiType } from '../user/namespace';

export namespace ArticleApiType {
  // 创建文章请求参数
  export interface CreateRequest {
    title?: string;
    preview?: string;
    description?: string;
    content?: string;
    categoryId?: string;
    status?: boolean;
  }

  // 更新文章请求参数
  export interface UpdateRequest extends CreateRequest {
    id?: string;
  }

  // 文章详情请求参数
  export interface DetailRequest {
    id: string;
  }

  // 文章列表请求参数
  export interface Request {
    id?: string;
    page?: number;
    row?: number;
    title?: string;
  }

  // 文章栏目
  export interface Category {
    id: string;
    title: string;
  }

  // 文章
  export interface Article {
    id?: string;
    title?: string;
    preview?: string;
    description?: string;
    content?: string;
    createAt?: string;
    updateAt?: string;
    status?: boolean;
    user?: UserApiType.Info;
    category?: Category;
    comments?: any[]; // todo: 评论列表
  }

  export interface DeleteRequest {
    ids: string[];
  }

  export interface UpdateStatusRequest {
    ids: string[];
    status: boolean;
  }
}
